function animate(obj, destination, callback = null, time = 20) {
  clearInterval(obj.timer);
  obj.timer = setInterval(() => {
    var step = (destination - obj.offsetLeft) / 10;
    step = step > 0 ? Math.ceil(step) : Math.floor(step);
    obj.style.left = obj.offsetLeft + step + "px";
    if (obj.offsetLeft === destination) {
      clearInterval(obj.timer);
      callback && callback();
    }
  }, time);
}
